UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vhJAtEbs6U5fL4PLTFZ0+6zbokeazxzCB4EtRthYQuI='
WHERE
key_id = 'f500bc85b580e5e9e208ddd456ce8d466f72291f823167d3fa66aa28d082d7d2'
AND (
token = 'vhJAtEbs6U5fL4PLTFZ0+6zbokeazxzCB4EtRthYQuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)