UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+jLT/wnmwt3H/fVhKY8aCk3ZpgURI4AE/wrZhhQ3LE=' 
WHERE 
  key_id = '171036c3fb6d2929964217f3ab6764764d885109b82be9ee585788ff13676531' 
  AND (
    token = 'c+jLT/wnmwt3H/fVhKY8aCk3ZpgURI4AE/wrZhhQ3LE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029