UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tRygvQyOCiIpY29k6wHRmCoKaKy2xhVJSLloKt5l8+8=' 
WHERE 
  key_id = '369d8889c4abf26ed1e4feb3d0e495d38ccd50773b8aa84a40409d03c2ff4fb7' 
  AND (
    token = 'tRygvQyOCiIpY29k6wHRmCoKaKy2xhVJSLloKt5l8+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037