UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XGVtWpD8uMfVRRzhSw2J09nKXMIs107NFrFfSoW1oPw='
WHERE
key_id = 'bee8350c75272c3afe5caa6bd6b73b759ae1c87859afdd110b4f75fb3f9a7e1b'
AND (
token = 'XGVtWpD8uMfVRRzhSw2J09nKXMIs107NFrFfSoW1oPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)