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