UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RB8yQJQ2f4ZaThQhFQ+p+QFwLxPL82DOM+2S5ajkeR8='
WHERE
key_id = 'c8e5ff3e9e84bd1e738b91f111396644101a8d2a54717588b119f434d41314d4'
AND (
token = 'RB8yQJQ2f4ZaThQhFQ+p+QFwLxPL82DOM+2S5ajkeR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)