UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZD1h5P1AlhEVXlBpyf4wSnKpxC7fkb4dorI5BIBf8R0='
WHERE
key_id = '56b0bc50c5947cdfac7d570e8640bc71d992a30b3073c169c5790c34d7c230f2'
AND (
token = 'ZD1h5P1AlhEVXlBpyf4wSnKpxC7fkb4dorI5BIBf8R0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)