UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qPSqvNByAxMnUny3TpRXIzvtumO8ow3vFr+vH1wmDMI='
WHERE
key_id = 'f827506399066f173d013f2341c5c4fc2a102df62c2b766e5cb5dd0cdb8b9432'
AND (
token = 'qPSqvNByAxMnUny3TpRXIzvtumO8ow3vFr+vH1wmDMI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)