UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nxBNELvFGs5IFktSroe+7Z0eRvjpW5SQ+S0TJLdOR1U=' 
WHERE 
  key_id = '5a454f5203e1dbc4a3b9d932e19a356df9de2e4942cbb344ad687e9502ec5496' 
  AND (
    token = 'nxBNELvFGs5IFktSroe+7Z0eRvjpW5SQ+S0TJLdOR1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025