UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n1Dpfod0mbVfqCSBUYAcNC8gJ5nOwXZ9thhHVv/TG+I=' 
WHERE 
  key_id = '1f9909fa9b167984e40839209821fa4b6b3132d8473bda0a2a70677794b0eda2' 
  AND (
    token = 'n1Dpfod0mbVfqCSBUYAcNC8gJ5nOwXZ9thhHVv/TG+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043