UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3TSlaBHOghTXKJApcgTC5BUjlzg18tsw+TlglpdOGI0='
WHERE
key_id = '9d9853088127360f55871d31190bdf6054a73e8738724fa47b8498d990f4bb2f'
AND (
token = '3TSlaBHOghTXKJApcgTC5BUjlzg18tsw+TlglpdOGI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)