UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0iKqOwhG5ueOiQwrdhN0HDHblxbp1iqIuuyqLkif8cw='
WHERE
key_id = '96ced3aef3793d09e479510b1542f4bba3f0fc8e53073ff6620d31c7f9b67ec4'
AND (
token = '0iKqOwhG5ueOiQwrdhN0HDHblxbp1iqIuuyqLkif8cw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)