UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mtOPNWehOzLzBRWAdF22+98+dqnnD+xW3fC+5329HJc='
WHERE
key_id = '1b4976e9b18bb611dbb86639b8969940cfee27cf7dc43c5fff1118db26bfc71a'
AND (
token = 'mtOPNWehOzLzBRWAdF22+98+dqnnD+xW3fC+5329HJc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)