UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RlnoUn7zqx7cHRtTqO8kIACPb9OqfyqYVZlF0eA5yYo='
WHERE
key_id = '17db0f2aa26f744e8761789356da88afbe34f2f6352b762e96d21bcf90d5a0a0'
AND (
token = 'RlnoUn7zqx7cHRtTqO8kIACPb9OqfyqYVZlF0eA5yYo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)