UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qqh32iJmQaeiRSpl0MsHz6aH2tV0gwSndaFGGOLqydc='
WHERE
key_id = '4bf2d1dd9e1df03f1d3b8e52358f9e52043120cd91106bc77d92239b1672113c'
AND (
token = 'Qqh32iJmQaeiRSpl0MsHz6aH2tV0gwSndaFGGOLqydc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)