UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xVaVN7aRU2Q4YTd1LKjDqI7o/eCrUabI96U+IHLZhfo='
WHERE
key_id = '247258d086a6978f1879dc3e58e923db88536b6e6003990b3dbdf2bcff7e3d24'
AND (
token = 'xVaVN7aRU2Q4YTd1LKjDqI7o/eCrUabI96U+IHLZhfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)