UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'piSABkxORVWZxKj7uv9nMtuIqzVEjKQ8/sDQR1FWXso='
WHERE
key_id = 'f4ca72dd4813aeec144e7a8d19e3911622e65d9dae77e270b305127fa492c9e2'
AND (
token = 'piSABkxORVWZxKj7uv9nMtuIqzVEjKQ8/sDQR1FWXso='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)