UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3cCTx8B9kWJq5UE+HA9+xP/+sLX1ID2MJJUCXoK+vTk='
WHERE
key_id = 'a4ffa04ef46c375f3d3019539ea74e539a5050b5767e6fdafde53c4416e31a16'
AND (
token = '3cCTx8B9kWJq5UE+HA9+xP/+sLX1ID2MJJUCXoK+vTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)