UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oSl4an4l++PxnI5nQQVt8/mPY+IZNvgut8lo5FneLQ0='
WHERE
key_id = 'e79dc1d1478628fd4219754944f64c40dd1900979a19e6b7f91db794f2f1a384'
AND (
token = 'oSl4an4l++PxnI5nQQVt8/mPY+IZNvgut8lo5FneLQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)