UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6tOo/REJp10qzdXqnsrZVwVAYvNl9LzHDLTqmRYZbnY=' 
WHERE 
  key_id = 'f646adaa73a296d21b78c7aae63487d6f8264b71b4be1836e05ed850cb936756' 
  AND (
    token = '6tOo/REJp10qzdXqnsrZVwVAYvNl9LzHDLTqmRYZbnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037