UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g8AC3DFd3EapU9OCFR1J1G7bkdQXObEXeDe8tNweDoU='
WHERE
key_id = '8e3d456d22bc85fd6bdc19e59a25124ea4a55d43d690201227e60e7d78973d78'
AND (
token = 'g8AC3DFd3EapU9OCFR1J1G7bkdQXObEXeDe8tNweDoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)