UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GO/EapqaPEOJQDHCmHafSWQva1JLFSRTonrl0poN+Vc=' 
WHERE 
  key_id = '7c781b13a8372061b5d71c83df4342df75cb85423c3f33c6137eebd7f18b28de' 
  AND (
    token = 'GO/EapqaPEOJQDHCmHafSWQva1JLFSRTonrl0poN+Vc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039