UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HubgPutvuGVmQO5rCBiuA9edNPqMZMNO2XtOO6Fj2q4='
WHERE
key_id = '045e5a33f49c429d2ba51e59dbc4b2881795790d8b727619daa14fadb5abd65f'
AND (
token = 'HubgPutvuGVmQO5rCBiuA9edNPqMZMNO2XtOO6Fj2q4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)