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

Query time 0.00040