UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kmlYLHJbunMlry07TjFa8ZWqaHkF4ebcLDaWcE4sMQw='
WHERE
key_id = '958ca9f3263ca2c6dbce7776d8d3100ad27e17b2e7770a322524277b9eee6954'
AND (
token = 'kmlYLHJbunMlry07TjFa8ZWqaHkF4ebcLDaWcE4sMQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)