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

Query time 0.00019