UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wwDU++OTaICsWRzwJh+HptEuotrrTuBVZuK7gJw3YtE=' 
WHERE 
  key_id = '64a8c7c76bd81b90e653154f2e5182ac02e7eaed4ba5c97e248c1ae705450e7c' 
  AND (
    token = 'wwDU++OTaICsWRzwJh+HptEuotrrTuBVZuK7gJw3YtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028