UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0hP/vVRz5ObCWB3B3rBHJsRmSbTabpkaCSLFnRbVHM0='
WHERE
key_id = '87df730a184211429dc49a53b90ec564b6a7ebc9e1750b3ed7e22efad72c55a0'
AND (
token = '0hP/vVRz5ObCWB3B3rBHJsRmSbTabpkaCSLFnRbVHM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)