UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bsGzjAe9UhPHlpTKEvSqilzdl8ZGJaz+PH9JLvV+Pvo='
WHERE
key_id = '252fffae487539b909862495b7b1647ce7ae53c161abbb4368311b5d352f96e0'
AND (
token = 'bsGzjAe9UhPHlpTKEvSqilzdl8ZGJaz+PH9JLvV+Pvo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)