UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A9pU8t2tjtVTnJwtF82v3+z+1dCfVtKRt13etZCJ25M='
WHERE
key_id = 'd6bb9af4927b0f5906dd1200421f17681676aa255c6494fd0d3af7e2604dd389'
AND (
token = 'A9pU8t2tjtVTnJwtF82v3+z+1dCfVtKRt13etZCJ25M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)