UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u6inmH8e9ny2S0M6FH7582lZklLENUHIeVPPwteYpyA=' 
WHERE 
  key_id = '1c56648bbd699161eabe7e5c56130e0b2dd9b6ff8f4e52e39c22e9978f701cfc' 
  AND (
    token = 'u6inmH8e9ny2S0M6FH7582lZklLENUHIeVPPwteYpyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035