UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ob9NzwHONJaUBc49HLDE0ef4L0KGeAB1nA+RiYfcJVE=' 
WHERE 
  key_id = '29f81db28856753f152e3298e1420d5cf4e1ac198ce38daca5912d3c3a6fc2bf' 
  AND (
    token = 'Ob9NzwHONJaUBc49HLDE0ef4L0KGeAB1nA+RiYfcJVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019