UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+td8INXiNP4mwfF4P8Eu6qYznBQfi+mpPYxxIluxHw=' 
WHERE 
  key_id = '2b3a6ecccc5020acf129e85f62e460f08b25b42018a457e5834e6225f52c3337' 
  AND (
    token = 'L+td8INXiNP4mwfF4P8Eu6qYznBQfi+mpPYxxIluxHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034