UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aaX0HNBKwQuiX5GUL/fdsR5Ei1mxHnVfYYQtFImnKA8='
WHERE
key_id = '1695ff5bcf373f5e33f9a4b8267f21803e66e3e6622675a73d542687f2d0db61'
AND (
token = 'aaX0HNBKwQuiX5GUL/fdsR5Ei1mxHnVfYYQtFImnKA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)