UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aSAIRk/QH+uhEFonh2XD4FFkzXzRIQduCO8zv2nveAU='
WHERE
key_id = 'c4437d4c56b501863c5e471075fc803c69f87521827e9548d6f09ffcdf5a6ad5'
AND (
token = 'aSAIRk/QH+uhEFonh2XD4FFkzXzRIQduCO8zv2nveAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)