UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'udMnoh+eFj6u0bq8n0zSneMPqQMPbOLFilmFC0sCZ7I=' 
WHERE 
  key_id = '64d718288decc1cadb89b9ca2f7e5c04f4a69aaf9d48efe17ee572f16a506be9' 
  AND (
    token = 'udMnoh+eFj6u0bq8n0zSneMPqQMPbOLFilmFC0sCZ7I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028