UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GYNn3pGIburJV3h3dH2BVDSVQVkVxAoZWdSaC28zE4M=' 
WHERE 
  key_id = '3d004cba8981309217a839d3c2bc2cd85f7dcb083525bca49224039abf416bc3' 
  AND (
    token = 'GYNn3pGIburJV3h3dH2BVDSVQVkVxAoZWdSaC28zE4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038