UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DjnQXjaPGHxpLriNza4L9QCcMytA7yhpNXh4HUulK0M='
WHERE
key_id = '1f8ee3a1cf36135236fe81215264e028b63b0c7b0d27d5767968c0549f97ecf0'
AND (
token = 'DjnQXjaPGHxpLriNza4L9QCcMytA7yhpNXh4HUulK0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)