UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BrJ7Tj/5U8KPWd57e/Wapv4oy6j63qGf4SzRW3v93C0='
WHERE
key_id = 'de002660da49f5bb66e654478c0c6382e2fc0c068bb1fcbccde79e717f8c6455'
AND (
token = 'BrJ7Tj/5U8KPWd57e/Wapv4oy6j63qGf4SzRW3v93C0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)