UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gb8AryhgfvxTwVs0Fk9cOh5KO3UTjHbNfjvkPWawlwQ=' 
WHERE 
  key_id = 'a3af9a42c212221cca700ebe8b0d5509b280f6fb41d84f2ef3300998dd6c90a1' 
  AND (
    token = 'Gb8AryhgfvxTwVs0Fk9cOh5KO3UTjHbNfjvkPWawlwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022