UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qpqjzz6D46oNY4NiMG7ojKmT5DxciFe5NowvvHs3R2o='
WHERE
key_id = 'e522944493dcd6313420529f04689fe20bdca55d3d335f24d7149f5a84817613'
AND (
token = 'Qpqjzz6D46oNY4NiMG7ojKmT5DxciFe5NowvvHs3R2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)