UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '51NMLBGW+vlJ7tlc705Eqd4yvu5FUWHUGESKbcwdjg0='
WHERE
key_id = '0ba4b6d498dcc870983cfd5845423dbf067148d6a19756c55864e9a5a4f29ec1'
AND (
token = '51NMLBGW+vlJ7tlc705Eqd4yvu5FUWHUGESKbcwdjg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)