UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TeEOHog4batGIk5u6a7MdNaFr40yEcwpXlaHbixXBxk=' 
WHERE 
  key_id = '6937a9150ea2cf3d1b5e8f2e0719a151199adb0177d490941821d2fb69480c0b' 
  AND (
    token = 'TeEOHog4batGIk5u6a7MdNaFr40yEcwpXlaHbixXBxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028