UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JpYdmbkS7W0feoKvYSZB8CEr2NGS4H64pXIBwHlWaYE=' 
WHERE 
  key_id = '9b644927b44860226eefb8802393b52c6ac60857f08a9866283e15e8a27ea821' 
  AND (
    token = 'JpYdmbkS7W0feoKvYSZB8CEr2NGS4H64pXIBwHlWaYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051