UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0AofWyeKRUlSNzfZpjRIk8PCAjVYLXvqYaKmjpevS/A='
WHERE
key_id = '1c059493be6aca7fe90bfdbf3f5ee584ca92c398137c37159a661619949d0aa9'
AND (
token = '0AofWyeKRUlSNzfZpjRIk8PCAjVYLXvqYaKmjpevS/A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)