UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HJ54ylt3aJWaaMdxBSGtiQMubOQztcFvKWut4y8SE2k=' 
WHERE 
  key_id = '426e415669da22f72a22006d9d2413788a1a81c4ec314e8919e37eecf8359243' 
  AND (
    token = 'HJ54ylt3aJWaaMdxBSGtiQMubOQztcFvKWut4y8SE2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036