UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xZPKJq41zTCFDKxiYsni3rZwjSttrXJciGCAhmxExHk=' 
WHERE 
  key_id = '573567c6d31965499ddf0cec10fa386ec6d582dc651482676d4fced7f8bd68f3' 
  AND (
    token = 'xZPKJq41zTCFDKxiYsni3rZwjSttrXJciGCAhmxExHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040