UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P5zAhlY0+tW1qUxaTw552BefnRPZYPIai3WxQvFtojQ='
WHERE
key_id = 'a3290267ec3f627c573d31990fe05571331595a22b6a10edba2c753d95889fb5'
AND (
token = 'P5zAhlY0+tW1qUxaTw552BefnRPZYPIai3WxQvFtojQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)