UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yXaGno+Du+B8FcRNIcBYpOFvVyKIEDzUyli1AF6Sgbs=' 
WHERE 
  key_id = '1a70f619d5c4cc482f36ef84efa2349c4b44a2212d018812df7b618f044cea52' 
  AND (
    token = 'yXaGno+Du+B8FcRNIcBYpOFvVyKIEDzUyli1AF6Sgbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051