UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uIvvv3eGwFgg27TTi9ErpkXSPNTDOxLyMEw8E+sJfjA=' 
WHERE 
  key_id = '949d7de67ad63f01ba9acf2d78ffa623730504b334de678f3392bfb73cbffba9' 
  AND (
    token = 'uIvvv3eGwFgg27TTi9ErpkXSPNTDOxLyMEw8E+sJfjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025