UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y3GpIJDecfY4bgvNHBuOXIQEq2nSe+2pu/ylxiiByQk='
WHERE
key_id = '52edacf522b38e244f76ea8958a1dfd95b8cdaef9337e1813fa8750c6c82aa6f'
AND (
token = 'y3GpIJDecfY4bgvNHBuOXIQEq2nSe+2pu/ylxiiByQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)